package br.com.rookgraph.utils;

import br.com.rookgraph.Graph;
import br.com.rookgraph.branchreduce.BranchReduce;
import br.com.rookgraph.branchreduce.BranchReduceNotEstanque;
import br.com.rookgraph.branchreduce.BranchReducePlus;
import br.com.rookgraph.heuristica.Alterado;
import br.com.rookgraph.heuristica.Heuristica;
import br.com.rookgraph.heuristica.Normal;
import br.com.rookgraph.heuristica.NotEstanque;
import br.com.rookgraph.heuristica.Plus;
import br.com.rookgraph.heuristica.Plus2;


/**
 * Criado para amarar Heuristica a um determinado 
 * algoritmo que roda;
 * 
 * @author Luan Pontes
 * @singe 30-04-13
 *
 */
public enum ExecuteHeuristicas {
	
	NORMAL {
		@Override
		public Graph execute(Graph original, Graph tree) {
			return new BranchReduce(original, tree, instance()).execute();
		}

		@Override
		public Normal instance() {
			return new Normal();
		}

	},
	
	ALTERADO {
		@Override
		public Graph execute(Graph original, Graph tree) {
			return new BranchReduce(original, tree, instance()).execute();
		}

		@Override
		public Alterado instance() {
			return new Alterado();
		}
	},
	
	PLUS {
		@Override
		public Graph execute(Graph original, Graph tree) {
			return new BranchReduce(original, tree, instance()).execute();
		}

		@Override
		public Plus instance() {
			return new Plus();
		}
	},
	
	PLUS2 {
		@Override
		public Graph execute(Graph original, Graph tree) {
			return new BranchReducePlus(original, tree, instance()).execute();
		}

		@Override
		public Plus2 instance() {
			return new Plus2();
		}
	},
	
	NOT_ESTANQUE {
		@Override
		public Graph execute(Graph original, Graph tree) {
			return new BranchReduceNotEstanque(original, tree, instance()).execute();
		}

		@Override
		public NotEstanque instance() {
			return new NotEstanque();
		}
	};
	
	public abstract Heuristica instance(); 
	
	public abstract Graph execute(Graph original, Graph tree);

}
